﻿using System;
using Net5ApiAndEfMySql.DtoModel.SystemAdmin;
using Net5ApiAndEfMySql.IService;
using Net5ApiAndEfMySql.IService.SystemAdmin;
using Net5CommonLib.SystemLib.Common;

namespace Net5ApiAndEfMySql.Service
{

    public class BaseService : IBaseService
    {
        public readonly static string TokenHeaderKey = "X-Token";
        /// <summary>
        /// 获取登录token, 在header头中
        /// </summary>
        /// <returns></returns>
        public static string GetTokenByHeader()
        {
            return HttpContextManager.GetHeaderPara(TokenHeaderKey);
        }
        public OperatorDto LoginUser
        {
            get
            {
                return DiManager.GetDiObjScoped<IOperatorService>().GetLoginUserByToken(Token);
            }
        }
        public string Token
        {
            get
            {
                return HttpContextManager.GetHeaderPara("X-Token");
            }
        }
    }
}
